﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Maticsoft.Model.CarrefourCover;
using System.Data;
using WebSite.Core;
using Shanda.Utility;
using Common;

namespace WebSite
{
    public partial class BabyList_old : BasePage
    {
        public override bool NeedLogin
        {
            get
            {
                return false;
            }
        }

        public List<Team> TeamListData { get; set; }

        public int RowTotal { get; set; }
        public new int PageIndex { get { return WebUtils.GetPostValue(Request, "PageIndex", 0); } }        
        public new int PageSize { get { return 6; } }


        protected void Page_Load(object sender, EventArgs e)
        {
            Core.NavHelper.SetNavMenuSelectedIndex(2);


            var teamBll = new Maticsoft.BLL.CarrefourCover.Team();

            string strWhere="and status=1";

            if (!string.IsNullOrEmpty(Request["query"]))
            {
                string query = Request["query"].SqlFilter();
                strWhere += "AND (TeamName like '%" + query + "%' OR BabyAName like '%" + query + "%' OR BabyBName like '%" + query + "%')";
            }

            string orderby = "";
            switch (Request["ordertype"])
            {
                case "2":
                    orderby = "order by TeamVoteNum desc";
                    break;
                case "3":
                    orderby = "order by createtime desc";
                    break;
                default:
                    orderby = "order by id desc";
                    break;
            }
            // string orderby="order by id desc";
            int totalCount=0;

          

            TeamListData = teamBll.GetListByPage(PageSize, PageIndex + 1, strWhere, orderby, out  totalCount);

            RowTotal = totalCount;

        }
    }
}